//Effect converts pixels in a texture to be grayscale by using the dot operation



float MaterialRColor;
float MaterialGColor;
float MaterialBColor;

float AmbiantPercent;
float AmbiantRColor;
float AmbiantGColor;
float AmbiantBColor;

float LightPercent;
float LightRColor;
float LightGColor;
float LightBColor;


float Alpha;

sampler TextureSampler: register(s0);
float4 PixelShaderFunction(float2 Tex: TEXCOORD0) : COLOR0
{
	float4 Color = tex2D(TextureSampler, Tex);

	float r = Color.r;
	float g = Color.g;
	float b = Color.b;

	r = r *  MaterialRColor ;
	g = g *  MaterialGColor;
	b = b *  MaterialBColor;

	r = r * AmbiantPercent * AmbiantRColor ;
	g = g * AmbiantPercent * AmbiantGColor ;
	b = b * AmbiantPercent * AmbiantBColor ;
	
	r = r + (r*LightPercent * LightRColor) * (1/AmbiantPercent) ;
	g = g + (g*LightPercent * LightGColor) * (1/AmbiantPercent) ;
	b = b + (b*LightPercent * LightBColor) * (1/AmbiantPercent) ;

	/*

	V1
		r = r * ((0.3*MaterialRColor ) + (AmbiantPercent * AmbiantRColor  ) + (LightPercent * LightRColor ));
		g = g * ((0.3*MaterialGColor ) + (AmbiantPercent * AmbiantGColor ) + (LightPercent   * LightGColor ));
		b = b * ((0.3*MaterialBColor ) + (AmbiantPercent * AmbiantBColor ) + (LightPercent  * LightBColor ));
	*/


	/*

	V2
	
	r = r *  MaterialRColor ;
	g = g *  MaterialGColor;
	b = b *  MaterialBColor;

	r = r * AmbiantPercent* AmbiantRColor ;
	g = g * AmbiantPercent* AmbiantGColor ;
	b = b * AmbiantPercent* AmbiantBColor ;
	
	r = r + (r*LightPercent * LightRColor) * (1/AmbiantPercent) ;
	g = g + (g*LightPercent * LightGColor) * (1/AmbiantPercent) ;
	b = b + (b*LightPercent * LightBColor) * (1/AmbiantPercent) ;

	*/

	Color.r = r ;
	Color.g = g ;
	Color.b = b ;



	if(r != 0 || g != 0 || b != 0)
		Color.a = Alpha;
	
	return Color;
}

technique hit
{
	pass Pass1
	{
		PixelShader = compile ps_2_0 PixelShaderFunction();
	}
}

/*

//Effect converts pixels in a texture to be grayscale by using the dot operation

float LightPercent;
float RColor;
float GColor;
float BColor;


float Alpha;

sampler TextureSampler: register(s0);
float4 PixelShaderFunction(float2 Tex: TEXCOORD0) : COLOR0
{
	float4 Color = tex2D(TextureSampler, Tex);

	float r = Color.r;
	float g = Color.g;
	float b = Color.b;

	r = r * (LightPercent * RColor) ;
	g = g * LightPercent * GColor;
	b = b * LightPercent * BColor;
	
	Color.r = r ;
	Color.g = g ;
	Color.b = b ;



	if(r != 0 || g != 0 || b != 0)
		Color.a = Alpha;
	
	return Color;
}

technique hit
{
	pass Pass1
	{
		PixelShader = compile ps_2_0 PixelShaderFunction();
	}
}


*/